<%@ page pageEncoding="utf-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ page import="com.sasis.Constants"%>
<head> 
<title><fmt:message key="user.common.title.label"/></title>
<link href="../styles/layout.css" rel="stylesheet" type="text/css" />
<script type='text/javascript'  src="<c:url value='/scripts/common.js'/>" ResponseEncoding="utf-8"></script>
<script src="<c:url value='/scripts/change_region.js'/>"></script>
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	background-color: #F4F4F4;
	font-size:12px;
}
-->
<!--  
a:link { text-decoration: none}  
a:active { text-decoration: none }  
a:visited { text-decoration: none }  
--> 
</style>

</head>
<body>
<%--bean:define id="form" name="userInfoBean" type="com.sasis.webapp.form.UserInfoBean"/--%>
<html:form action="/manage/userInsert.shtml?action=insert" styleId="userInfoBean">

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td height="25" class="home-content-title">
    <img src="../images/passenger.gif" align="absmiddle"/>
     增加用户
    </td>
  </tr>
  <logic:messagesPresent>
		<tr id="messagesPresentTrId" style="display:;">
			<td valign="top" class="black12" height="20">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
					<tr>
						<td class="arror_bg">
							<span class="arror_title">
						     您的操作存在如下错误：<br></span>
						     <html:errors/>
					    </td>
				    </tr>
			    </table>
			</td>
		</tr>
  </logic:messagesPresent>
  <tr id="messageShowTrId" style="display:none;">
	<td valign="top" class="black12">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
	<td class="arror_bg">
	<span class="arror_title"> 
     您的操作存在如下错误：<br/>
     </span>
     <span id="warnPasswordSpanId" style="display:none">
      <li>密码不一致，请重新输入<br/>
     </span>
     <span id="warnSaveMsgSpanId" style="display:none">
      <li>保存失败，<c:out value="${errors}"/><br/>
     </span>
    </td>
    </tr>
    </table>
	</td>
	</tr>
  <tr>
    <td height="20" class="home-search-space">&nbsp;带*标志的选项为必填项。</td>
  </tr>
  <tr>
    <td valign="top"> 
      <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
        <html:hidden property="id"/>
        <tr> 
          <td class="home-table-topline"> </td>
        </tr>
        <tr> 
          <td class="home-table-leftline"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-tool-content">
					<input  type="button"  class="home-inputBtn" value="保存" onclick="javascript:save();">
					<input name="Submit3" type="button" class="home-inputBtn" onclick="document.forms[0].reset();" value="重写">
                    <input  type="button"  class="home-inputBtn" value="取消" onclick="window.close();"/>
				</td>
              </tr>
              <tr>
                <td align="center" valign="top">&nbsp;</td>
              </tr>
              <tr> 
                <td valign="top" class="home-edittable-space"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td><table width="100%" border="0" cellpadding="4" cellspacing="1" class="home-subtable-bgcolor">
                          <tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font><fmt:message key="user.common.name"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="enName" size="18" styleClass="home-table-inputbox"/>
                            </td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="user.common.cnName"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text  property="cnName" styleClass="home-table-inputbox"/> 
                            </td>
                          </tr>
                          <tr> 
                            <td class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font><fmt:message key="user.common.password"/>：</td>
                            <td width="30%" class="home-subtable-view-tdstyle-left">
                            <html:password property="password" styleClass="home-table-inputbox"/>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font><fmt:message key="user.common.department"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
	                            <input class="home-table-inputbox" type="text" name="deptName" id="selectedText" size="10" value="<c:out value="${userInfoBean.deptName}"/>" readonly/>
						    	<input name="Submit" type="button" class="home-inputBtn" onclick="MM_openBrWindow('../deptChoose.html','','width=200,height=400,status=yes')" value="选择" />
						    	<input type="hidden" name="deptId" id="selectedId" value="<c:out value="${userInfoBean.deptId}"/>"/>
					    	</td>
                          </tr>
                          <tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font>确认密码：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <input type="password" name="confirmPwd" class="home-table-inputbox"/>
                            </td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="user.common.email"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="email" styleClass="home-table-inputbox"/> 
                            </td>
                          </tr>
                          <%--tr>
							<td width="110" class="leftd"><fmt:message key="userForm.addressForm.country"/>：</td>
						    <td class="rightd">
												 <html:select property="country"  onchange="
														 change_region(window.document.forms[0].province ,
														 window.document.forms[0].country.options[selectedIndex].value );">
													<html:option value="">-- 所有国家 --</html:option>
													<script language="javascript">
					       								set_select_options( window.document.forms[0].country, country, "" ) ;
													</script>
												</html:select>
						    
						    </td>
						    <td width="110" class="leftd"><fmt:message key="userForm.addressForm.province"/>：</td>
						    <td class="rightd">
					                                <html:select property="province" onchange="change_region(window.document.forms[0].city ,
					                                		window.document.forms[0].province.options[selectedIndex].value );">
															<html:option value="">-- 所有州/省--</html:option>
													</html:select>
						    </td>
						 
						</tr--%>
						<tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font><fmt:message key="user.common.phone"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="phone" size="18" onkeyup="javascript:isNotChinese(this);" styleClass="home-table-inputbox" maxlength="16"/>
                            </td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <font color="red">*</font><fmt:message key="user.common.msisdn"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="msisdn" styleClass="home-table-inputbox" maxlength="11" size="20"/>
                            </td>
                          </tr>
                          <%--tr>
  
						    <td><fmt:message key="userForm.addressForm.city"/>：</td>
						    <td class="rightd">   <html:select property="city">
															<html:option value="">-- 城市 --</html:option>
														  </html:select></td>
						  	
						 </tr--%>
						 <tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="user.common.addr"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="addr" size="30" styleClass="home-table-inputbox" maxlength="100"/>
                            </td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="userForm.addressForm.postalCode"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="postalCode" styleClass="home-table-inputbox"/>
                            </td>
                          </tr>
                          <tr> 
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="user.common.isUsable"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:checkbox property="isUsable" value="0"/>
                            </td>
                            <td width="20%" class="home-subtable-view-tdstyle-right">
                            <fmt:message key="user.common.memo"/>：</td>
                            <td class="home-subtable-view-tdstyle-left">
                            <html:text property="memo" styleClass="home-table-inputbox" maxlength="500"/>
                            </td>
                          </tr>
                        </table></td>
                    </tr>
                  </table> 
                  
                </td>
              </tr>
            </table>
		  </td>
        </tr>
        <tr> 
          <td height="12">
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td class="home-table-bottom-left">&nbsp;</td>
                <td class="home-table-bottom-bg">&nbsp;</td>
                <td class="home-table-bottom-right">&nbsp;</td>
              </tr>
            </table></td>
        </tr>
      </table>
	  
	  </td>
  </tr>
  <tr>
    <td height="10">&nbsp;</td>
  </tr>
</table>


<%--
<table border="0" cellspacing="0" cellpadding="10" class="width100">
  <tr>
    <td style="padding-bottom:0px; padding-top:5px;">	
	
	<table border="0" cellspacing="0" cellpadding="0" align="right">
      <tr>
        <td class="but_left">&nbsp;</td>
        <td class="but_mid"><a href="#" onclick="javascript:document.forms[0].submit();"><fmt:message key="common.button.insert"/></a></td>
        <td class="but_right">&nbsp;</td>
        <td class="but_kong">&nbsp;</td>
        
      </tr>
    </table>
    </td></tr>
    <tr><td>

	
	<table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="padding10px">&nbsp;</td>
      </tr>
    </table>
	
	
	<table border="0" cellspacing="0" cellpadding="10" class="width100">
  <tr>
    <td style="padding-top:0px;">
	
	</td>
  </tr>
</table>
--%>

</html:form>
</body>
<script>
	function save(){ 
		//if(document.forms[0].deptName.value==""){
			//alert("部门名称不能为空!");	
 		//}else
 	   if(document.forms[0].password.value == document.forms[0].confirmPwd.value){
	 		document.forms[0].submit();
 		}else {
 			//alert("密码不一致，请重新输入!");
 			var messageShowTrId=document.getElementById("messageShowTrId");
 			var messagesPresentTrId=document.getElementById("messagesPresentTrId");
 			var warnPasswordSpanId=document.getElementById("warnPasswordSpanId");
 			var warnSaveMsgSpanId=document.getElementById("warnSaveMsgSpanId");
 			
 			if(messageShowTrId!=null)
 			   messageShowTrId.style.display="";
 			if(warnPasswordSpanId!=null)
 			  warnPasswordSpanId.style.display="";
 			if(messagesPresentTrId!=null&&messagesPresentTrId.style.display=="")
 			   messagesPresentTrId.style.display="none";
 			if(warnSaveMsgSpanId!=null&&warnSaveMsgSpanId.style.display=="")
 			   warnSaveMsgSpanId.style.display="none";
 			//document.forms[0].password.value = "";
 			document.forms[0].confirmPwd.value = "";
 		}	
 		
 	}
 	
	function checkEmail(obj){ 
	if(obj.value=="") return;
    var myReg = /^([-_A-Za-z0-9\.]+)@([_A-Za-z0-9]+\.)+[A-Za-z0-9]{2,3}$/;    
    if(myReg.test( obj.value )) return true;    
    alert("请输入合法的电子邮件地址");   
    obj.value="";
    return false;    
}  
   

</script>
<p>

<%--font color="red">
 
<html:errors/><br>
 
</font--%> 

<script> 
	function resetForm(){
        userInfoBean.reset();
    }
	function fVrfToEngStr(str,iptName) { 
        for(i=0;i<str.length;i++) { 
            ecStr=str.substr(i,1);ascStr=ecStr.charCodeAt() 
            if(ascStr>127) {  
                alert("用户名必须为英文!") 
                document.getElementById(iptName).value="" 
                return;
            } 
        } //shawl.qiu script 
    } 
	
</script>
<script>
	var flag = "<c:out value="${flag}"/>";
	var errors = "<c:out value="${errors}"/>";
	if(flag == "success") {
		//alert("保存信息成功!");
		refreshParent();
		window.close();
		 
	}else{
		if(null!=errors&&""!=errors) {
			//alert("保存信息失败!")
			//alert(errors);
			var messageShowTrId=document.getElementById("messageShowTrId");
 			var messagesPresentTrId=document.getElementById("messagesPresentTrId");
 			var warnSaveMsgSpanId=document.getElementById("warnSaveMsgSpanId");
 			var warnPasswordSpanId=document.getElementById("warnPasswordSpanId");
 			
 			if(messageShowTrId!=null)
 			   messageShowTrId.style.display="";
 			if(warnSaveMsgSpanId!=null)
 			   warnSaveMsgSpanId.style.display="";
 			if(messagesPresentTrId!=null&&messagesPresentTrId.style.display=="")
 			   messagesPresentTrId.style.display="none";
 		    if(warnPasswordSpanId!=null&&warnPasswordSpanId.style.display=="")
 			   warnPasswordSpanId.style.display="none";
		}
	}	
</script>
</html>
